package cn.kgc.tangcco.service.impl;

import cn.kgc.tangcco.mapper.DujitangMapper;
import cn.kgc.tangcco.model.ResponseText;
import cn.kgc.tangcco.model.ResultCode;
import cn.kgc.tangcco.pojo.Dujitang;
import cn.kgc.tangcco.service.DujitangService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/12/29 14:52
 */
@Service
public class DujitangServiceImpl implements DujitangService {

    @Autowired
    private DujitangMapper dujitangMapper;


    @Override
    public List<Dujitang> queryAll() {
        return dujitangMapper.selectList(new QueryWrapper<Dujitang>());
    }

    @Override
    public ResponseText<Dujitang> queryRandom() {
        return new ResponseText<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(),dujitangMapper.selectOneByRandom() );
    }

}
